package com.esri.core.map;

import com.esri.core.internal.util.d;
import java.io.Serializable;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.Map;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class FeatureTemplate implements Serializable {
    private static final long serialVersionUID = 1;
    private String a;
    private String b;
    private Map<String, Object> c;
    private DRAWING_TOOL d;

    /* loaded from: classes.dex */
    public enum DRAWING_TOOL {
        NONE("esriFeatureEditToolNone"),
        POINT("esriFeatureEditToolPoint"),
        LINE("esriFeatureEditToolLine"),
        POLYGON("esriFeatureEditToolPolygon"),
        AUTO_COMPLETE_POLYGON("esriFeatureEditToolAutoCompletePolygon"),
        CIRCLE("esriFeatureEditToolCircle"),
        ELLIPSE("esriFeatureEditToolEllipse"),
        RECTANGLE("esriFeatureEditToolRectangle"),
        FREEHAND("esriFeatureEditToolFreehand"),
        TRIANGLE("esriFeatureEditToolTriangle"),
        LEFT_ARROW("esriFeatureEditToolLeftArrow"),
        RIGHT_ARROW("esriFeatureEditToolRightArrow"),
        UP_ARROW("esriFeatureEditToolUpArrow"),
        DOWN_ARROW("esriFeatureEditToolDownArrow"),
        TEXT("esriFeatureEditToolText");
        
        String a;

        DRAWING_TOOL(String str) {
            this.a = str;
        }

        public String getValue() {
            return this.a;
        }

        public static DRAWING_TOOL fromString(String str) {
            if (str == null) {
                return null;
            }
            Iterator it = EnumSet.allOf(DRAWING_TOOL.class).iterator();
            while (it.hasNext()) {
                DRAWING_TOOL drawing_tool = (DRAWING_TOOL) it.next();
                if (drawing_tool.a.equals(str)) {
                    return drawing_tool;
                }
            }
            return null;
        }
    }

    public FeatureTemplate(String str, String str2, Map<String, Object> map, DRAWING_TOOL drawing_tool) {
        this.a = str;
        this.b = str2;
        this.c = map;
        this.d = drawing_tool;
    }

    public FeatureTemplate() {
    }

    public String getName() {
        return this.a;
    }

    public String getDescription() {
        return this.b;
    }

    public Map<String, Object> getPrototype() {
        return this.c;
    }

    public DRAWING_TOOL getDrawingTool() {
        return this.d;
    }

    public static FeatureTemplate fromJson(JsonParser jsonParser) throws Exception {
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            return null;
        }
        FeatureTemplate featureTemplate = new FeatureTemplate();
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("name".equals(currentName)) {
                featureTemplate.a = jsonParser.getText();
            } else if ("description".equals(currentName)) {
                featureTemplate.b = jsonParser.getText();
            } else if ("drawingTool".equals(currentName)) {
                String text = jsonParser.getText();
                if (text != null) {
                    featureTemplate.d = DRAWING_TOOL.fromString(text);
                }
            } else if ("prototype".equals(currentName)) {
                Graphic j = d.j(jsonParser);
                if (j != null) {
                    featureTemplate.c = j.getAttributes();
                }
            } else {
                jsonParser.skipChildren();
            }
        }
        return featureTemplate;
    }
}
